home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '87 / Source ƒ.sea / Source ƒ / emacs source ƒ / DG10.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-28  |  3.2 KB  |  189 lines  |  [TEXT/MARC]

  1. /*
  2.  * The routines in this file provide support for the Data General Model 10
  3.  * Microcomputer.
  4.  */
  5.  
  6. #define    termdef    1            /* don't define "term" external */
  7.  
  8. #include        <stdio.h>
  9. #include    "estruct.h"
  10. #include        "edef.h"
  11.  
  12. #if     DG10
  13.  
  14. #define NROW    24                      /* Screen size.                 */
  15. #define NCOL    80                      /* Edit if you want to.         */
  16. #define    NPAUSE    100            /* # times thru update to pause */
  17. #define    MARGIN    8            /* size of minimim margin and    */
  18. #define    SCRSIZ    64            /* scroll size for extended lines */
  19. #define BEL     0x07                    /* BEL character.               */
  20. #define ESC     30                      /* DG10 ESC character.          */
  21.  
  22. extern  int     ttopen();               /* Forward references.          */
  23. extern  int     ttgetc();
  24. extern  int     ttputc();
  25. extern  int     ttflush();
  26. extern  int     ttclose();
  27. extern    int    dg10kopen();
  28. extern    int    dg10kclose();
  29. extern  int     dg10move();
  30. extern  int     dg10eeol();
  31. extern  int     dg10eeop();
  32. extern  int     dg10beep();
  33. extern  int     dg10open();
  34. extern    int    dg10rev();
  35. extern    int    dg10close();
  36.  
  37. #if    COLOR
  38. extern    int    dg10fcol();
  39. extern    int    dg10bcol();
  40.  
  41. int    cfcolor = -1;        /* current forground color */
  42. int    cbcolor = -1;        /* current background color */
  43. int    ctrans[] = {        /* emacs -> DG10 color translation table */
  44.     0, 4, 2, 6, 1, 5, 3, 7};
  45. #endif
  46.  
  47. /*
  48.  * Standard terminal interface dispatch table. Most of the fields point into
  49.  * "termio" code.
  50.  */
  51. TERM    term    = {
  52.         NROW-1,
  53.         NCOL,
  54.     MARGIN,
  55.     SCRSIZ,
  56.     NPAUSE,
  57.         dg10open,
  58.         dg10close,
  59.     dg10kopen,
  60.     dg10kclose,
  61.         ttgetc,
  62.         ttputc,
  63.         ttflush,
  64.         dg10move,
  65.         dg10eeol,
  66.         dg10eeop,
  67.         dg10beep,
  68.     dg10rev
  69. #if    COLOR
  70.     , dg10fcol,
  71.     dg10bcol
  72. #endif
  73. };
  74.  
  75. #if    COLOR
  76. dg10fcol(color)        /* set the current output color */
  77.  
  78. int color;    /* color to set */
  79.  
  80. {
  81.     if (color == cfcolor)
  82.         return;
  83.     ttputc(ESC);
  84.     ttputc(0101);
  85.     ttputc(ctrans[color]);
  86.     cfcolor = color;
  87. }
  88.  
  89. dg10bcol(color)        /* set the current background color */
  90.  
  91. int color;    /* color to set */
  92.  
  93. {
  94.     if (color == cbcolor)
  95.         return;
  96.     ttputc(ESC);
  97.     ttputc(0102);
  98.     ttputc(ctrans[color]);
  99.         cbcolor = color;
  100. }
  101. #endif
  102.  
  103. dg10move(row, col)
  104. {
  105.     ttputc(16);
  106.         ttputc(col);
  107.     ttputc(row);
  108. }
  109.  
  110. dg10eeol()
  111. {
  112.         ttputc(11);
  113. }
  114.  
  115. dg10eeop()
  116. {
  117. #if    COLOR
  118.     dg10fcol(gfcolor);
  119.     dg10bcol(gbcolor);
  120. #endif
  121.         ttputc(ESC);
  122.         ttputc(0106);
  123.         ttputc(0106);
  124. }
  125.  
  126. dg10rev(state)        /* change reverse video state */
  127.  
  128. int state;    /* TRUE = reverse, FALSE = normal */
  129.  
  130. {
  131. #if    COLOR
  132.     if (state == TRUE) {
  133.         dg10fcol(0);
  134.         dg10bcol(7);
  135.     }
  136. #else
  137.     ttputc(ESC);
  138.     ttputc(state ? 0104: 0105);
  139. #endif
  140. }
  141.  
  142. dg10beep()
  143. {
  144.         ttputc(BEL);
  145.         ttflush();
  146. }
  147.  
  148. dg10open()
  149. {
  150.     revexist = TRUE;
  151.         ttopen();
  152. }
  153.  
  154. dg10close()
  155.  
  156. {
  157. #if    COLOR
  158.     dg10fcol(7);
  159.     dg10bcol(0);
  160. #endif
  161.     ttclose();
  162. }
  163.  
  164. dg10kopen()
  165.  
  166. {
  167. }
  168.  
  169. dg10kclose()
  170.  
  171. {
  172. }
  173.  
  174. #if    FLABEL
  175. fnclabel(f, n)        /* label a function key */
  176.  
  177. int f,n;    /* default flag, numeric argument [unused] */
  178.  
  179. {
  180.     /* on machines with no function keys...don't bother */
  181.     return(TRUE);
  182. }
  183. #endif
  184. #else
  185. dg10hello()
  186. {
  187. }
  188. #endif
  189.